/*
Contains:
	client variables
	client verbs (related to the interface)
	client procs, related to:
		the spell creation window
		the book window
	client/Topic
*/

client/view = 7

client
	New()
		..()
		sleep(10)
		path = "players/[copytext(ckey,1,2)]/[ckey]/"
		if(fexists(path))
			for(var/o in dd_file2list(path+"names.txt"))
				players += o
		else
			for(var/x = 1 to MAX_CHARS)
				players += "New Character"
				text2file(players[x], path)

		if(players.len < MAX_CHARS)
			for(var/x=players.len to MAX_CHARS)
				players += "New Character"
				text2file(players[x], path)

		draw_char_buttons()

client/var
	draginfo/dragging
	chars_left
	list/players = list()
	list/tooltips = list()
	path

	mouse_x
	mouse_y

	//used for tooltips
	uid

client
	verb

		use(n as num)
			set hidden = 1
			var/player/p = mob
			if(n > p.hotkeys.len) return
			var/hotkey/h = p.hotkeys[n]
			if(h && h.cast)
				h.cast.LeftClick(mob)

		allow_move()
			set hidden = 1
			mob.can_move = 1

	proc
		update_mouse()
			src << output({"
<html>
	<head>
		<script type="text/javascript">
			function coordinate(event)
			{
				window.location="?action=mousecoord&x="+event.screenX+"&y="+event.screenY
			}
		</script>
	</head>
	<body onload="coordinate(event)">
	</body>
</html>
"},"window1.browser1")

	Topic(href, hlist[])

		var/new_word = hlist[hlist[1]]

		if(findtext(hlist[1], "add")) { add_component_button(new_word); return}
		switch(hlist["action"])
			if("mousecoord")
				mouse_x = text2num(hlist["x"])
				mouse_y = text2num(hlist["y"])

			if("modify")
				show_newfoo_args(hlist["type"],hlist["name"],hlist["desc"])